Vecto TypeScript SDK Client Documentation
Here is the documentation for our TypeScript Client.
Installation
npm install @xpressai/vecto-client
For the token, sign up for your access here.
Quickstart
- Text
- Image
import { Configuration, IndexApi, IndexDataRequest, LookupApi, LookupRequest } from '@xpressai/vecto-client';
const config = new Configuration({
accessToken: 'your-vecto-token'
});
// Ingest
const indexApi = new IndexApi(config);
const textBlob = new Blob(["Hello Vecto"]);
const textDataParams: IndexDataRequest = {
vectorSpaceId: your-vector-space-id,
modality: 'TEXT',
attributes: [JSON.stringify("sample metadata")],
input: [textBlob];
};
await indexApi.indexData(textDataParams);
// Lookup
const lookupApi = new LookupApi(config);
const textParams: LookupRequest = {
vectorSpaceId: your-vector-space-id,
modality: 'TEXT',
topK: 3,
query: 'text query',
};
const results = await lookupApi.lookup(textParams);
import { Configuration, IndexApi, IndexDataRequest, LookupApi, LookupRequest } from '@xpressai/vecto-client';
import fs from 'fs';
const config = new Configuration({
accessToken: 'your-vecto-token'
});
// Ingest
const indexApi = new IndexApi(config);
const fileContent = fs.readFileSync('image-to-ingest.png');
const imageBlob = new Blob([fileContent]);
const imageDataParams: IndexDataRequest = {
vectorSpaceId: your-vector-space-id,
modality: 'IMAGE',
attributes: [JSON.stringify("sample metadata")],
input: [imageBlob];
};
await indexApi.indexData(imageDataParams);
// Lookup
const lookupApi = new LookupApi(config);
const imageBlob = new Blob([fileContent]);
const fileContent = fs.readFileSync('image-to-lookup.png');
const imageParams: LookupRequest = {
vectorSpaceId: your-vector-space-id,
modality: 'IMAGE',
topK: 3,
query: imageBlob,
};
const results = await lookupApi.lookup(imageParams);
Developers Discord
Have any questions or need support? Feel free to chat with the devs at our Discord!
Support
For issues with the SDK, please raise a GitHub issue. For issues related to the API or other inquiries, please contact Vecto support.